package com.taskmanagement.service;

import com.taskmanagement.mapper.ReviewMapper;
import com.taskmanagement.entity.Review;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigInteger;

@Service
public class ReviewService {

    @Autowired
    private ReviewMapper reviewMapper;

    public Review findByTaskId(BigInteger taskId) {
        return reviewMapper.findByTaskId(taskId);
    }

    public Review createReview(Review review) {
        reviewMapper.insert(review);
        return review;
    }

    public Review updateReview(Review review) {
        reviewMapper.update(review);
        return review;
    }

    public boolean deleteReview(BigInteger id) {
        return reviewMapper.delete(id) > 0;
    }

    public Review findById(BigInteger id) {
        return reviewMapper.findById(id);
    }
}
